<link rel='stylesheet' type='text/css' href='<?php echo base_url()?>fullcalendar/cupertino/theme.css' />
<link rel='stylesheet' type='text/css' href='<?php echo base_url()?>fullcalendar/fullcalendar/fullcalendar.css' />
<link rel='stylesheet' type='text/css' href='<?php echo base_url()?>fullcalendar/fullcalendar/fullcalendar.print.css' media='print' />
<script type='text/javascript' src='<?php echo base_url()?>fullcalendar/jquery/jquery-ui-1.8.17.custom.min.js'></script>
<script type='text/javascript' src='<?php echo base_url()?>fullcalendar/fullcalendar/fullcalendar.min.js'></script>
<script type='text/javascript'>

<?php
		$base_url = base_url();
?>


	$(document).ready(function() {
	
		var date = new Date();
		var d = date.getDate();
		var m = date.getMonth();
		var y = date.getFullYear();
		
		var calendar = $('#calendar').fullCalendar({
			selectable: false,
			selectHelper: true,
			select: function(start, end, allDay) {
				var title = prompt('Nama Batch Pelatihan:');
				if (title) {
					calendar.fullCalendar('renderEvent',
						{
							title: title,
							start: start,
							end: end,
							allDay: allDay,
							
						},
						true // make the event "stick"
					);
				}
				calendar.fullCalendar('unselect');
			},
			
			
			editable: false,
			

			events: [
				<?php
					foreach ($batch->result() as $row){
						//$data[''] = $row->NAMA_BATCH;
						$bulan_entry = $row->BULAN_ENTRY-1;
						$bulan_selesai = $row->BULAN_SELESAI-1;
						echo "
						{
                                                title: '".$row->NAMA_BATCH." (".$row->TEMPAT." )',
						start: new Date(".$row->TAHUN_ENTRY.", ".$bulan_entry.", ".$row->TANGGAL_ENTRY."),
						end: new Date(".$row->TAHUN_SELESAI.", ".$bulan_selesai.", ".$row->TANGGAL_SELESAI."),
						url: ''
						},
						";
					}
				?>
				
				
			]
		});
		
	});

</script>
</head>
<body>
<div class="hspacer"></div>
<nav class="hnav">
    <div class="hbtn">
		<?
			$lisensi_name = $this->session->userdata('nama_lisensi');
			if($lisensi_name != '')
			{
				$link = ''.base_url().'/index.php/batch/batch/form_batch';
				echo'
					<a href="'.$link.'">+ Tambah Batch</a>
				';
			}
		?>
    
    </div>
</nav>
<div id='calendar'></div>